#!/usr/bin/env python 
# -*- coding:utf-8 -*-
import json
import time


class douyin_info(object):
    id = None  # 唯一主键（uid_createTime）
    createTime = int(time.time() * 1000)  # 创建时间戳
    uid = None  # uid
    douId = None  # 抖音id
    name = None  # 名称
    focus = None  # 关注
    focusUnit = None  # 关注单位
    follower = None  # 粉丝
    followerUnit = None  # 粉丝单位
    liked = None  # 赞
    likedUnit = None  # 赞单位
    works = None  # 作品
    liked2 = None  # 喜欢
    worksList = None  # 接口数据

    def __init__(self, uid, douId, name, focus, focusUnit, follower, followerUnit,
                 liked, likedUnit, works, liked2, worksList=None):
        self.uid = uid
        self.douId = douId
        self.name = name
        self.focus = focus
        self.focusUnit = focusUnit
        self.follower = follower
        self.followerUnit = followerUnit
        self.liked = liked
        self.likedUnit = likedUnit
        self.works = works
        self.liked2 = liked2
        self.worksList = worksList
        self.createTime = int(time.time() * 1000)
        self.id = '{}_{}'.format(self.uid, self.createTime)

    def get_json(self):
        try:
            return json.dumps(self.__dict__, ensure_ascii=False)
        except:
            return None
